package de.baumann.browser.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import de.baumann.browser.R;
import de.baumann.browser.api.net.vo.Order;

/**
 * @author:
 * @date:2018/12/22 15:49
 * @discription: 充值订单适配器
 */
@SuppressWarnings("ALL")
public class RechargeOrderAdapter extends BaseQuickAdapter<Order, BaseViewHolder> {

    public RechargeOrderAdapter(int layoutResId) {
        super(layoutResId);
    }

    @SuppressWarnings("AliDeprecation")
    @Override
    protected void convert(BaseViewHolder helper, Order item) {
        helper.setText(R.id.tvOrderId,  mContext.getString(R.string.order_code) + item.getOrderId());
        helper.setText(R.id.tvOrderTime, item.getOrderTime());
        TextView tvOrderStatus = helper.getView(R.id.tvOrderStatus);

        if (item.getOrderStatus() == 1) {
            tvOrderStatus.setText(R.string.recharge_successful);
            tvOrderStatus.setTextColor(mContext.getResources().getColor(R.color.blue_3A81F6));
        } else {
            tvOrderStatus.setText(R.string.recharge_failed);
            tvOrderStatus.setTextColor(mContext.getResources().getColor(R.color.color_txt_red));
        }
    }
}
